Skip to content

Conversation

@mdrxy
Copy link
Member

@mdrxy mdrxy commented Nov 13, 2025

Based largely on the excellent foundational work done by @emhagman in #1077

TODO

  • Test streaming with structured output in all conditions
  • Investigate warnings that some params aren't supported (_ALLOWED_SCHEMA_FIELDS_SET)

https://googleapis.github.io/python-genai/index.html

Closes #853
Closes #1212
Closes #1265
Closes #1360
Closes #1362
Closes #1366
Closes #1367
Closes #1376
Closes #1409

@mdrxy mdrxy changed the title feat(genai): big kahuna migration to google-genai feat(genai): migration to google-genai Nov 13, 2025
@mdrxy mdrxy changed the title feat(genai): migration to google-genai feat!(genai): migration to google-genai Nov 13, 2025
@mdrxy mdrxy changed the title feat!(genai): migration to google-genai feat(genai)!: migration to google-genai Nov 13, 2025
return configs


# Dynamically create test classes for each backend
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid this complication, for Vertex I'd be OK re-implementing tests on a fast model and running them on release + a schedule.

@mdrxy mdrxy marked this pull request as ready for review December 4, 2025 15:35
Copilot AI review requested due to automatic review settings December 4, 2025 15:35
Copilot finished reviewing on behalf of mdrxy December 4, 2025 15:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the langchain-google-genai package from using google-ai-generativelanguage to the newer google-genai SDK. This is a major infrastructure change that modernizes the integration with Google's Generative AI APIs.

Key Changes:

  • Migrates from google-ai-generativelanguage protobuf-based SDK to google-genai Pydantic-based SDK
  • Updates all imports from google.ai.generativelanguage to google.genai.types
  • Removes transport-related parameters (client_options, transport) in favor of HTTP-based configuration
  • Adds comprehensive test coverage for new SDK features

Reviewed changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
libs/genai/uv.lock Updates dependency lock file with new google-genai package and updated transitive dependencies
libs/genai/pyproject.toml Adds google-genai>=1.52.0,<2.0.0 as a core dependency
libs/genai/tests/unit_tests/test_standard.py Updates tests for new SDK, adds API key parameter
libs/genai/tests/unit_tests/test_llms.py Migrates from GAPIC client mocking to new SDK client mocking
libs/genai/tests/unit_tests/test_imports.py Adds create_context_cache to expected imports
libs/genai/tests/unit_tests/test_function_utils.py Comprehensive updates for Pydantic-based type system
libs/genai/tests/unit_tests/test_common.py Reorganizes test ordering
libs/genai/tests/unit_tests/test_chat_models_protobuf_fix.py Deleted (tests moved to main test file)
libs/genai/tests/unit_tests/test_chat_models.py Major refactoring for new SDK, adds extensive new tests
libs/genai/tests/unit_tests/__snapshots__/test_standard.ambr Updates model name format snapshot
libs/genai/tests/integration_tests/test_llms.py Adds proper client cleanup in async tests
libs/genai/tests/integration_tests/test_builtin_tools.py Deleted (functionality removed/relocated)
libs/genai/tests/conftest.py Adds backend configuration fixtures for testing both Google AI and Vertex AI
libs/genai/langchain_google_genai/llms.py Removes client_options parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

or "gemini-1.5-flash" in self.model
or "gemini-2" in self.model
)
return self.profile.get("tool_choice", True) if self.profile else True
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

want to flag that we default to True

tool_call_chunks = []
for part in response_candidate.content.parts:

parts = response_candidate.content.parts or [] if response_candidate.content else []
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in what situation is it not under parts?

populate_by_name=True,
)

@property
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to keep?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment